package com.qiangesoft.blog.controller.web;

import com.qiangesoft.blog.core.entity.BlogFriendChain;
import com.qiangesoft.blog.core.service.IBlogFriendChainService;
import com.qiangesoft.blog.system.pojo.vo.BlogFriendChainVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 友情链接 前端控制器
 * </p>
 *
 * @author qiange
 * @date 2023-05-06
 */
@RestController
@RequestMapping("/api/friendChain")
@Api(tags = "友情链接")
@RequiredArgsConstructor
public class ApiBlogFriendChainController {

    private final IBlogFriendChainService friendLinkService;

    @PostMapping(value = "/apply")
    @ApiOperation(value = "申请友链")
    public void addLink(@RequestBody BlogFriendChain friendLink) {
        friendLinkService.applyFriendLink(friendLink);
    }

    @GetMapping
    @ApiOperation(value = "友链列表")
    public List<BlogFriendChainVO> webFriendLinkList() {
        return friendLinkService.webFriendLinkList();
    }

}

